package cn.shangtour.diary.controller;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import cn.shangtour.common.pojo.Diary;
import cn.shangtour.common.vo.DiaryResult;
import cn.shangtour.common.vo.DiaryUIResult;
import cn.shangtour.diary.diaryservice.DiaryService;

@RestController
@RequestMapping("/dia")
public class DiaryController {
	//发布游记
	@Autowired
	private DiaryService diaryService;
	@RequestMapping("/diasave")
	public DiaryResult diarySave(Diary diary){
		try {
			diaryService.diarySave(diary);
			return DiaryResult.ok();
		} catch (Exception e) {
			e.printStackTrace();
			return DiaryResult.build(201, e.getMessage(),null);
		}
	}
	
	//游记分页查询
	@RequestMapping("/diarypage")
	public DiaryUIResult diaryPageQuery(Integer page,Integer rows){
		DiaryUIResult diaresult=diaryService.diaryPageQuery(page,rows);	
		return diaresult;
	}
	
	
	
	
	
	
	
}
